package com.office.anywher.utils;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;

import com.wenxy.httpclient.request.HttpClientUtil;

public class ActivityStackUtil {
	private static List<Activity> activityList = new ArrayList<Activity>();
	private static  ActivityStackUtil mActivityStackUtil;
	private ActivityStackUtil(){}
	public synchronized static ActivityStackUtil getInstance(){
		if(mActivityStackUtil==null){
			mActivityStackUtil = new ActivityStackUtil();
		}
		return mActivityStackUtil;
	}
	public  void remove(Activity activity) {
		activityList.remove(activity);
	}
	public  void add(Activity activity) {
		activityList.add(activity);
	}
	public void exit() {
		for (Activity activity : activityList) {
			activity.finish();
		}
		HttpClientUtil.setNull();
		android.os.Process.killProcess(android.os.Process.myPid());
		System.exit(0);
	}

}
